home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 051-075 / disk_073 / expose / expose.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  3KB  |  95 lines

  1. /*
  2.  *  This program will attempt to let you at the screen depth arrangment
  3.  *  gadgets. All windows that are tight to the top border will be moved
  4.  *  down by one pixel, and resized if necessary (ie they are as high as
  5.  *  the screen). After running it, you can also access the screen drag
  6.  *  bars.
  7.  *
  8.  *  Does anyone else hate having to fiddle with the initial CLI window
  9.  *  and the VT100 window to get at those $@$@#$@ gadgets???
  10.  *
  11.  *  ((c)) 1987, John Russell
  12.  *  Unlimited distribution; donations to starving programmers always welcome.
  13.  */
  14.  
  15. /*
  16.  *  This is the second posting of this program. The first would act flakey,
  17.  *  since there was a missing ",0L" in the OpenLibrary call. It would work
  18.  *  time after time in some cases, and not at all in others.
  19.  *
  20.  *  This release also incorporates a fix which should keep it from moving any
  21.  *  windows which really don't want to be moved (the DPaint window is one
  22.  *  example). I initially used a delay to see if the window responded to the
  23.  *  sizewindow message; it seems like the sizewindow itself may introduce
  24.  *  problems, so I no longer try to size the window if it has no size gadget.
  25.  *  There is no delay, but the window will not be moved if it is full screen-
  26.  *  height and cannot be resized.
  27.  */
  28.  
  29. char *copyright = "((c)) 1987, John Russell";
  30. char *address = "5 Alderdice Place";
  31. char *city = "St. John's, Newfoundland, Canada";
  32. char *postal_code = "A1B 2P8";
  33. char *phone = "(709) 726-7847";
  34.  
  35. #include "intuition/intuition.h"
  36.  
  37. struct IntuitionBase *IntuitionBase;
  38.  
  39. main(argc, argv)
  40. int argc;
  41. char *argv[];
  42. {
  43.     struct Screen *screen;
  44.     struct Window *window;
  45.  
  46.     if ((IntuitionBase=(struct IntuitionBase *)OpenLibrary("intuition.library",0L))==NULL) {
  47.         exit(0);
  48.     }
  49.  
  50.     Forbid();
  51.  
  52.     screen=IntuitionBase->FirstScreen;
  53.  
  54.     while (screen) {
  55.  
  56.         window=screen->FirstWindow;
  57.  
  58.         while(window) {
  59.  
  60.             if (window->TopEdge == 0) {   /* NOT "== screen->topedge" */
  61.  
  62.                 if ((window->Height == screen->Height) &&
  63.                     (window->Flags & WINDOWSIZING)) {
  64.  
  65. /* window sent resizing message only if full screen-height AND it has a
  66.    sizing gadget. Otherwise results with backdrop windows and those with
  67.    odd Viewmodes, overscan, etc are unpredictable. */
  68.  
  69.                     SizeWindow(window,0,-1);
  70.                 }
  71.  
  72.                 if ((window->Height != screen->Height) ||
  73.                     (window->Flags & WINDOWSIZING) ) {
  74.  
  75. /* move a window that is
  76.     1) not as tall as the screen and hence can be lowered
  77.     2) equipped with a size gadget, which will shrink vertically when it
  78.        gets the first message
  79. */
  80.  
  81.                     MoveWindow(window,0,1); /* move down and expose gadgets */
  82.                 }
  83.             }
  84.             window=window->NextWindow;
  85.         }
  86.         screen=screen->NextScreen;
  87.     }
  88.  
  89.     Permit();
  90.  
  91.     CloseLibrary(IntuitionBase);
  92. }
  93.  
  94.  
  95.